require "test_helper"
class VulnerabilityCleanerTest < ActiveSupport::TestCase
  test "execute confirm it removes vulns based on task id" do
    result = Result.where(id: 2).first
    task = Task.where(id: 89).first

    assert_equal(2, result.metadata["vulnerabilities"].count)

    task.perform_task
    result = Result.where(id: 2).first

    assert_equal(0, result.metadata["vulnerabilities"].count)
    assert_equal(0, result.metadata["vulnerability_count"]["state"]["open"])
  end
  test "execute confirm it removes vulns based on value" do
    result = Result.where(id: 3).first
    task = Task.where(id: 88).first

    assert_equal(3, result.metadata["vulnerabilities"].count)

    task.perform_task
    result = Result.where(id: 3).first

    assert_equal(2, result.metadata["vulnerabilities"].count)
    assert_equal(2, result.metadata["vulnerability_count"]["state"]["open"])
  end
  # Add test for counter object
  #
end
